import {
  IsDate,
  IsEnum,
  IsInstance,
  IsOptional,
  IsString,
  IsUUID,
} from 'class-validator';
import {
  FileMetadata,
  MediaType,
} from 'src/modules/minio/dto/media-file-options.dto';
import { Nullable } from 'src/types/Nullable';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Media {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  ownerId: string;
  @Column()
  name: string;
  @Column({
    enum: MediaType,
  })
  type: MediaType;

  @IsInstance(FileMetadata)
  metadata: FileMetadata;

  @Column({
    type: 'timestamp with time zone',
  })
  createdAt: Nullable<string>;
  @Column({
    type: 'timestamp with time zone',
    nullable: true,
    default: null,
  })
  editAt: Nullable<string>;
  @Column({
    type: 'timestamp with time zone',
    nullable: true,
    default: null,
  })
  removeAt: Nullable<string>;
}
